package com.qianxunclub.chapter3;

import java.util.concurrent.Callable;

/**
 * @author chihiro.zhang
 */
public class CallableTest {
    /**
     * 统一处理逻辑，数据翻倍
     * @param callable
     * @return
     * @throws Exception
     */
    public static Integer t(Callable<Integer> callable) throws Exception{
        Integer i = 2;
        Integer v = callable.call();
        return i * v;
    }

    /**
     * 待处理的方法
     * @return
     */
    public static Integer sf(){
        Integer a = 10;
        Integer b = 20;
        return a + b;
    }

    public static void main(String[] arg) throws Exception {
        Integer r = CallableTest.t(CallableTest::sf);
        System.out.println(r);
    }
}
